
/**
 * list列表
 */

import 'package:moonplay/common/app_common.dart';
import 'package:flutter/material.dart';

class CommonListPage extends StatelessWidget {
  final Widget leftIcon;
  final Widget leftText;
  final Widget rightText;
  final Color backgroundColor;
  final MainAxisAlignment mainAxisAlignment;
  final bool isBottomLine;
  final GestureTapCallback onTap;
  final double widgetHeight;

  const CommonListPage({Key key, this.leftIcon, this.leftText, this.rightText, this.onTap, this.backgroundColor, this.mainAxisAlignment, this.isBottomLine = true, this.widgetHeight = 90.0}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: onTap,
      child: Container(
        width: double.infinity,
        height: ScreenUtil().getHeightPx(widgetHeight),
        padding: EdgeInsets.only(left: ScreenUtil().getWidthPx(30)),
        color: backgroundColor != null ? backgroundColor : Colors.transparent,
        child: Column(
          children: <Widget>[
            Container(
              height: ScreenUtil().getHeightPx(widgetHeight-2),
              padding: EdgeInsets.only(right: ScreenUtil().getWidthPx(15)),
              child: Row(
                mainAxisAlignment: mainAxisAlignment != null ? mainAxisAlignment : MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  Container(
                    child: Row(
                      children: <Widget>[
                        leftIcon != null ? leftIcon : Container(),
                        leftIcon != null ? SizedBox(width: ScreenUtil().getWidthPx(8)) : Container(),
                        leftText,
                      ],
                    ),
                  ),
                  Container(
                    child: Row(
                      children: <Widget>[
                        rightText != null ? rightText : Container(),
                        onTap != null ? CommonStyle.icons(0xe635, iconSize: 16) : Container(),
                      ],
                    ),
                  )
                ],
              ),
            ),
            isBottomLine
            ? CommonStyle.bottomLine()
            : Container()
          ],
        )
      ),
    );
  }
}